using System;
using System.Collections.Generic;
using UnityEngine;

public class PlayerDisplay : MonoBehaviour
{
	public UILabel nameLabel;

	public PersonaModel displayModel;

	public bool continuousAmbientUpdate;

	private Persona myPersona;

	private void OnEnable()
	{
		UITools.ChangeText(nameLabel, GGPlayerSettings.instance.Model.name);
		myPersona = new Persona(GGPlayerSettings.instance);
		ApplyInitialLooks();
	}

	private void ApplyInitialLooks()
	{
		foreach (object value in Enum.GetValues(typeof(CustomisationConfig.LookSetType)))
		{
			CustomisationConfig.LookSetType type = (CustomisationConfig.LookSetType)Enum.Parse(typeof(CustomisationConfig.LookSetType), value.ToString());
			CustomisationConfig.Look lookForType = myPersona.GetLookForType(type);
			if (lookForType != null)
			{
				lookForType.ApplyLook(displayModel, CustomisationConfig.ShaderUseType.MenuConfigPlayer);
			}
		}
		ApplyAmbientLighting();
	}

	private void ApplyAmbientLighting()
	{
		List<Transform> partsToUpdateForAmbient = displayModel.GetPartsToUpdateForAmbient();
		ObjectLookCustomization arenaForName = ScriptableObjectSingleton<ArenaCustomizations>.instance.GetArenaForName("Menu");
		if (arenaForName == null)
		{
			return;
		}
		ObjectLookCustomization.MaterialCustomization materialCustomization = null;
		foreach (ObjectLookCustomization.MaterialCustomization customization in arenaForName.customizations)
		{
			if (customization.name.ToLower() == "ambient")
			{
				materialCustomization = customization;
				break;
			}
		}
		if (materialCustomization != null)
		{
			materialCustomization.ApplyCustomization(partsToUpdateForAmbient);
		}
	}

	private void OnDisable()
	{
	}

	private void Update()
	{
	}
}
